package com.baizhi.service.impl;

import com.baizhi.entity.Record;
import com.baizhi.mapper.RecordMapper;
import com.baizhi.service.RecordService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = false,timeout = 5,propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED)

public class RecordServiceImpl implements RecordService {
    @Autowired
    private RecordMapper recordMapper;

    public void setRecordMapper(RecordMapper recordMapper) {
        this.recordMapper = recordMapper;
    }

    @Override
    public void insertRecord(Record record) {
        recordMapper.insertRecord(record);
    }

    @Override
    public void deleteById(int id) {
        recordMapper.deleteById(id);
    }

    @Override
    public void updateRecord(Record record) {
        recordMapper.updateRecord(record);
    }

    @Override
    public Record selectById(int id) {
        return recordMapper.selectById(id);
    }

    @Override
    public List<Record> selectAll(int pageNum, int pageSize) {
        return recordMapper.selectAll(pageNum, pageSize);
    }
}
